feat(PRO-547): bidirectional comment sync between the CLI and GitHub#70
feat(PRO-547): bidirectional comment sync between the CLI and GitHub#70dastratakos wants to merge 17 commits into
Conversation
…n editor, own-PR guard, permalinks, bodyHTML)
|
Ready to review this PR? Stage has broken it down into 7 individual chapters for you: Chapters generated by Stage for commit 6b25131 on Jun 22, 2026 9:40pm UTC. |
There was a problem hiding this comment.
cubic analysis
8 issues found across 29 files
Linked issue analysis
Linked issue: PRO-547: Bidirectional comment sync between the CLI and GitHub
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Pull existing PR review comments into the local/merged review view (load pending + submitted GitHub threads and merge with local threads). | New GitHub read layer, merged read model, and a review route are added; the UI switches to the new ReviewProvider. These changes show the PR fetches and surfaces pending/submitted GitHub threads alongside local threads. |
| ✅ | Push locally-authored comments back to the PR (create/reply/edit/delete pending comments, submit or discard a review). | The diff adds write mutations and server handlers for creating/replying/editing/deleting pending comments and submitting/discarding reviews, plus UI for drafting/submitting reviews — indicating the PR implements push paths to GitHub. |
| ✅ | Guardrails before pushing: ensure the working tree is clean and the local state matches the PR head (prevent mis-anchored/stale pushes, only push committed-scope comments). | New git helper functions to read HEAD SHA and check working-tree cleanliness are added, and the runs/review layer and summary mention scope-key/commit-scope checks and push guardrails, indicating these safety checks are implemented server-side before writes to GitHub. |
| Surface a clear result of what was pushed / skipped / failed to the user. | The code adds a ReviewResponse model and routing plus UI feedback (toasts, submit popover), suggesting structured results are produced and surfaced. The diff provides some evidence but the exact shape and completeness of a per-comment pushed/skipped/failed report is not fully verifiable from the shown diffs (and the PR hasn’t been exercised against a live PR). | |
| ✅ | Mirror and sync thread resolution state (resolve/reopen threads mirrored between CLI and GitHub). | Resolve/reopen flows are routed and wired into the GitHub review layer and the merged run review API, indicating thread resolution is synced. |
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aaf624e93f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…c promote, jsonFetch + own-PR hardening
There was a problem hiding this comment.
2 issues found across 11 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 105f8ac7a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d-path git errors
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2654445bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ueries after review writes
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 545fcf6f27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…invalidation to runId
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c4afec41d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…omote of a local thread
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b828070. Configure here.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
…se empty-review reject
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/github/review.ts">
<violation number="1" location="packages/cli/src/github/review.ts:200">
P2: Pending-comment counting relies on `comments(first: 100)` per review thread without pagination, so threads with more than 100 comments undercount pending drafts. This can cause the empty-review guard and UI tray to falsely treat a non-empty pending review as empty.</violation>
</file>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b251314c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Summary
Implements PRO-547: the CLI now works with a PR's GitHub review live instead of keeping a local mirror, surfacing three clearly-labeled comment states — Local (CLI-only, offline), Pending (your unsubmitted GitHub review draft, only you see it), and Submitted (published) — faithful to GitHub's own review model.
Changes
gh api graphql(github/review.ts): one paginated query loads pending + submitted threads, plus mutations to create/reply/edit/delete pending comments, submit a review (Comment / Approve / Request changes), discard it, and resolve/reopen threads.runs/review.ts,routes/review.ts,GET /api/runs/:id/review) that combine local DB threads with the PR's live GitHub threads, degrading to local-only whenghis offline or the run isn't a PR.Testing
pnpm typecheck,pnpm lint,pnpm test(385 tests, including new route-integration tests for the review API against a fakedgh), andpnpm buildall pass. Not yet exercised against a live PR.Summary by cubic
Bidirectional comment sync between the CLI and GitHub PR reviews, implementing PRO-547. The CLI shows Local, Pending, and Submitted states with draft/submit/resolve/discard flows that stay in sync with GitHub.
New Features
gh api graphql: load pending/submitted threads; create/reply/edit/delete pending comments; submit (Comment/Approve/Request changes) or discard; resolve/reopen.GET /api/runs/:runId/reviewcombines local threads with live GitHub threads; degrades to local-only whenghis unavailable, the PR is unresolvable, the run isn’t a PR, or the run’s diff isn’t at the PR head.giterrors; clearer error messages; refresh PR queries after review writes scoped to the current run; fix GraphQL variable passing by keeping string vars as-f.Migration
PATCH /api/comment-threads/:threadId; new review routes under/api/runs/:runId/review.ReviewProvideranduseReview; remove legacy comment thread components.@stagereview/typesaddsreviewmodels; no DB schema changes.Written for commit 6b25131. Summary will update on new commits.